package com.zhuhjay.statistics.controller;


import com.zhuhjay.commonutils.R;
import com.zhuhjay.statistics.service.StatisticsDailyService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.Map;

/**
 * <p>
 * 网站统计日数据 前端控制器
 * </p>
 *
 * @author ZhuHJay
 * @since 2022-09-10
 */
@Api(description = "网站统计日数据控制器")
@RestController
@RequestMapping("/staservice/sta")

public class StatisticsDailyController {

    @Resource
    private StatisticsDailyService dailyService;

    @ApiOperation("统计某一天的注册人数生成数据")
    @PostMapping("registerCount/{day}")
    public R registerCount(@PathVariable String day) {
        dailyService.registerCount(day);
        return R.ok();
    }

    @ApiOperation("获取统计数据")
    @GetMapping("showData/{type}/{begin}/{end}")
    public R showData(@PathVariable String type, @PathVariable String begin,
                      @PathVariable String end) {
        Map<String, Object> map = dailyService.showData(type, begin, end);
        return R.ok().data(map);
    }



}

